<template>
  <div class="home">
    <ul
      v-for="item in obj" :key="item.id"
    >
      <li>{{ item.title }}</li>
      <li>{{ item.content }}</li>
      <li>{{ item.author }}</li>
      <li>{{ item.add_time }}</li>
    </ul>
  </div>
</template>

<script>
import HelloWorld from '@/components/HelloWorld.vue'
import axios from 'axios'

export default {
  name: 'Home',
  data() {
    return {
      obj: []
    }
  },
  components: {
    HelloWorld
  },

  created() {
    this.getData()
  },
  methods: {
    getData() {
      axios.get(`http://127.0.0.1:8000//xinwens/`).then((res) => {
        this.obj = res.data
        console.log(this.obj)
      })
    }
  },
}
</script>

<style scoped lang="less">
a {
  text-decoration: none;
}

li {
  list-style-type: none;
}
</style>
